package model

import (
	"gorm.io/gorm"
	"time"
)

type ChatHistory struct {
	Id         uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	FormUserId uint           `gorm:"column:form_user_id;type:bigint(20) UNSIGNED;not null;" json:"form_user_id"`
	ToUserId   uint           `gorm:"column:to_user_id;type:bigint(20) UNSIGNED;not null;" json:"to_user_id"`
	RoomId     uint           `gorm:"column:room_id;type:bigint(20) UNSIGNED;not null;" json:"room_id"`
	CType      uint           `gorm:"column:c_type;type:tinyint(1) UNSIGNED;comment:1: 文字 2 图片 3 视频;not null;" json:"c_type"` // 1: 文字 2 图片 3 视频
	Content    string         `gorm:"column:content;type:varchar(255);not null;" json:"content"`
	CreatedAt  time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdateAt   time.Time      `gorm:"column:update_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"update_at"`
	DeleteAt   gorm.DeletedAt `gorm:"column:delete_at;type:datetime(3);default:NULL;" json:"delete_at"`
}

func (u *ChatHistory) TableName() string {
	return "chat_history"
}
